package com.nexttwist.common;

import com.nexttwist.pojo.User;

public class UserValidator {
BasicValidator basicValidator = new BasicValidator();

/**
 * To validate the mandatory fields of User object
 * 
 * @param user
 * @throws Exception
 */
	public void validateUser(User user) throws Exception{
		if(basicValidator.isEmptyOrNull(user.getEmail()))
			throw new Exception("Email id is Required");
		if(basicValidator.isEmptyOrNull(user.getDob()))
			throw new Exception("DOB is Required");
		if(basicValidator.isEmptyOrNull(user.getFirstName()))
			throw new Exception("FirstName is Required");
		if(basicValidator.isEmptyOrNull(user.getLastName()))
			throw new Exception("LastName is Required");
		if(basicValidator.isEmptyOrNull(user.getPassword()))
			throw new Exception("Password is Required");
		if(basicValidator.isEmptyOrNull(user.getGender()))
			throw new Exception("Gender is Required");
	}
}
